#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
struct resource *res;
int irqno;
int pdrv_probe(struct platform_device* pdev)
{
    printk("%s:%d\n", __func__, __LINE__);
    //获取IORESOURCE_MEM类型的资源
    res = platform_get_resource(pdev,IORESOURCE_MEM,0);
    if(res == NULL){
        printk("platform get resource error\n");
        return -ENODATA;
    }
    //获取中断类型的资源
    irqno = platform_get_irq(pdev,0);
    if(irqno < 0){
        printk("get irq resource error\n");
        return irqno;
    }
    printk("addr = %#llx,irqno = %d\n", res->start, irqno);

    return 0;
}
int pdrv_remove(struct platform_device* pdev)
{
    printk("%s:%d\n", __func__, __LINE__);
    return 0;
}
struct platform_driver pdrv = {
    .probe = pdrv_probe,
    .remove = pdrv_remove,
    .driver = {
        .name = "hahahaha",
    },
};
module_platform_driver(pdrv);
MODULE_LICENSE("GPL");